package com.grouppurchase.utils;

import cn.hutool.core.util.RandomUtil;

public class RandomCodeGenerator {
    
    public static String generateInviteCode(Long userId) {
        String prefix = "GP";
        String randomPart = RandomUtil.randomNumbers(6);
        String userSuffix = String.valueOf(userId % 10000);
        return prefix + randomPart + String.format("%04d", Integer.parseInt(userSuffix));
    }
    
    public static String generateGroupNo() {
        String timestamp = String.valueOf(System.currentTimeMillis());
        String randomPart = RandomUtil.randomNumbers(4);
        return "T" + timestamp.substring(7) + randomPart;
    }
    
    public static String generateOrderNo() {
        String timestamp = String.valueOf(System.currentTimeMillis());
        String randomPart = RandomUtil.randomNumbers(6);
        return "O" + timestamp + randomPart;
    }
}
